package com.lcp.se.controller;

import com.lcp.se.entity.data.Record;
import com.lcp.se.entity.result.PageResultForMini;
import com.lcp.se.entity.result.Result;
import com.lcp.se.service.RecordService;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 帮助记录
 *
 * @author lcp
 * @date 2020/8/17 22:26
 */
@RestController
@RequestMapping(path = "/user/record")
public class RecordController {
    @Resource
    private RecordService recordService;

    /**
     * 分页查询帮助记录
     *
     * @param pageSize    页大小
     * @param currentPage 当前页
     * @param userType    用户类型
     * @param openId      用户openId
     * @return  返回值
     */
    @RequestMapping(path = "/list")
    public Result<PageResultForMini<Record>> list(@RequestParam(name = "pageSize") Integer pageSize,
                                                  @RequestParam(name = "currentPage") Integer currentPage,
                                                  @RequestParam(name = "userType") Integer userType,
                                                  @RequestHeader(value = "openId") String openId) {
        return recordService.list(pageSize, currentPage, userType, openId);
    }
}
